/**
 * Copyright (c) 2012-2013 Nokia Corporation. All rights reserved.
 * Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation. 
 * Oracle and Java are trademarks or registered trademarks of Oracle and/or its
 * affiliates. Other product and company names mentioned herein may be trademarks
 * or trade names of their respective owners. 
 * See LICENSE.TXT for license information.
 */
package com.nokia.example.fuelcalculator.model;

import java.util.Date;

/**
 * An object of this class represents a single filling.
 */
public class ModelObject {
    private long dateInMillis;
    private double volume;
    private int distance;

    /**
     * Factory method for creating a ModelObject.
     * @param dateInMillis the date in milliseconds
     * @param volume is the amount of fuel in unit-agnostic way
     * @param distance in unit-agnostic way
     * @return ModelObject
     */
    public static ModelObject createModelObject(long dateInMillis, double volume, int distance) {
        return new ModelObject(dateInMillis, volume, distance);
    }
 
    /**
     * Returns the date.
     * @return Date
     */
    public Date getDate() {
        return new Date(dateInMillis);
    }
    
    /**
     * Returns the amount of fuel.
     * @return double
     */
    public double getVolume() {
        return volume;
    }
    
    /**
     * Returns the distance
     * @return int
     */
    public int getDistance() {
        return distance;
    }
    
    /**
     * Private constructor for preventing ill-mannered creation of a ModelObject.
     */
    private ModelObject() {
    }
    
    /**
     * Private constructor for creating a ModelObject.
     * @param date in milliseconds
     * @param volume is the amount of fuel in unit-agnostic way
     * @param distance in unit-agnostic way
     */
    private ModelObject(long date, double volume, int distance) {
        this.dateInMillis = date;
        this.volume = volume;
        this.distance = distance;
    }
}
